package com.yzh.homework;

import java.text.ParseException;
import java.util.Scanner;

/**
 * @author 于振晗
 * @title: HomeWork06
 * @description: TODO 输入某年某月某日，判断这一天是这一年的第几天？
 *                      分析：以3月5日为例，先把前两个月的加起来，然后再加上5天即本年第几天，特殊情况，
 *                      闰年且输入月份大于3需考虑多加一天。可定义数组存储1-12月各月天数。
 * @date 2020年08月18日
 * @path com.yzh.homework
 */
public class HomeWork06 {
    public static void main(String[] args) throws ParseException {
        Scanner scanner = new Scanner(System.in);
        int [] years = {31,28,31,30,31,30,31,31,30,31,30,31};
        System.out.println("输入年");
        int year = scanner.nextInt();
        System.out.println("输入月");
        int month = scanner.nextInt();
        System.out.println("输入日");
        int day = scanner.nextInt();

        int days = 0;
        for (int i = 0; i < years.length; i++) {
            days+=years[i];

            if (i+1 == month-1) {
                break;
            }
        }
        if (year % 400 == 0 && year % 100 != 0 || year % 100 == 0 && month>2) {
            days++;
        }
        days = days + day;

        System.out.println("总天数为："+days);
    }
}
